<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/pages/public/head.jsp"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>四维册—手册列表</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link href="<c:url value="/css/style_right.css" />" type="text/css"
			rel="stylesheet" />
		<script type="text/javascript" src="/js/jquery-1.7.1.js"></script>

		<script type="text/javascript">
	//创建手册
	function createHandBook(bookId) {
		var url = "books/books_createBook";
		$("<input/>", {
			type : "hidden",
			name : "handBook.id",
			val : bookId
		}).appendTo("#form");
		$("#form").attr("action", url);
		$("#form").submit();
	}

	//查看内容易图片
	function lookPics(userId, bookId) {
		var url = "picture/picture_showPicture";
		$("<input/>", {
			type : "hidden",
			name : "user.id",
			val : userId
		}).appendTo("#form");
		$("<input/>", {
			type : "hidden",
			name : "handBook.id",
			val : bookId
		}).appendTo("#form");
		$("#form").attr("action", url);
		$("#form").attr("target", "_blank");
		$("#form").submit();

		setTimeout(function() {
			window.top.location.reload();
		}, 1000);
	}

	//修改手册
	function replaceBookAll(bookId) {
		var url = "books/books_replaceBookAll?handBook.id=" + bookId;
		window.location.href = url;
	}

	//查看二维码
	function graphicsCode(bookId) {
		var url = "books/books_GraphicsCode?handBook.id=" + bookId;
		window.location.href = url;
	}

	//完成
	function complete(userId, bookId) {
		var url = "books/books_complete";
		$("<input/>", {
			type : "hidden",
			name : "user.id",
			val : userId
		}).appendTo("#form");
		$("<input/>", {
			type : "hidden",
			name : "handBook.id",
			val : bookId
		}).appendTo("#form");
		$("#form").attr("action", url);
		$("#form").submit();

	}
</script>
	</head>

	<body>
		<form id="form" action="" method="post">
		</form>
		<div class="right">
			<div class="userL">
				<li class="e1">
					<p>
						手册列表
					</p>
				</li>
				<input value="${user.id}" name="handBook.userId" type="hidden" />
			</div>
			<table border="0" cellpadding="0" cellspacing="1"
				style="background-color: #999" width=100% class="title">
				<tr height="40">
					<th align="center">
						目录
					</th>
					<th align="center" colspan="3">
						手册
					</th>
					<th align="center">
						操作
					</th>
				</tr>
				<c:forEach items="${page.data}" var="handBook">
					<tr>
						<td width="20%" align="center" rowspan="2">
							<a href="javascript:lookPics('${user.id}','${handBook.id}');">
								<img width=50px height=50px
									src="<c:url value='/images/defaulticon.png' />" alt="图标" />
							</a>
						</td>
						<td width="20%">
							<c:choose>
								<c:when test="${handBook.name==null}"> 无 </c:when>
								<c:otherwise>《${handBook.name}》</c:otherwise>
							</c:choose>
						</td>
						<td width="20%">
							<c:choose>
								<c:when test="${handBook.author==null}"> 无 </c:when>
								<c:otherwise>作者：${handBook.author}</c:otherwise>
							</c:choose>
						</td>
						<td width="20%">
							公司：${user.company}
						</td>
						<td width="20%" align="center" rowspan="2">
							<c:choose>
								<c:when test="${handBook.createStatus == 'uncreate'}">
									<a href="javascript:createHandBook('${handBook.id}');">操作</a>
								</c:when>

								<c:when test="${handBook.publishStatus == 'published'}">
									<a href="javascript:graphicsCode('${handBook.id}');">查看二维码</a>
								</c:when>

								<c:otherwise>
									<a href="javascript:replaceBookAll('${handBook.id}');">编辑</a>&nbsp;|&nbsp;
                        <a
										href="javascript:complete('${user.id}','${handBook.id}');">打包</a>
								</c:otherwise>

							</c:choose>
						</td>
					</tr>
					<tr>
						<td width="20%">
							创建时间：
							<fmt:formatDate value="${handBook.createDate}"
								pattern="yyyy-MM-dd" />
						</td>
						<td width="20%">
							<c:choose>
								<c:when test="${handBook.stopDate != null}"> 
                        	到期：<fmt:formatDate value="${handBook.stopDate}"
										pattern="yyyy-MM-dd" />
								</c:when>
								<c:otherwise>--</c:otherwise>
							</c:choose>
						</td>
						<td width="20%">
							<c:if test="${handBook.publishStatus == 'published'}">
							下载码:${handBook.downNum}
                        </c:if>
						<c:if test="${handBook.publishStatus != 'published'}">
							--
                        </c:if>
					  </td>
					</tr>
				</c:forEach>
			</table>
			<br />
			<div align="center">
				<s:include value="/pages/public/pagination.jsp"></s:include>
			</div>

		</div>

		<div style="clear: both"></div>
		</div>
	</body>
	<style type="text/css">
div#bookname {float left;
	
}
div
#


</
html
>
